<style>
    <!--
    #game_main{background: url("/public/flash/game/3e137d9e63d5a8e34fefb8bfd1aab357/gamedd.jpg");width: 920px;height: 610px}
    #play_1{background: url("/public/flash/game/3e137d9e63d5a8e34fefb8bfd1aab357/kaishiyouxi.png") 0 -160px;width: 202px;height: 80px;display: block;text-indent: -9999px;position: relative;top:360px;left: 342px;}
    #play_1:hover{ background-position: 0 -80px;}
    #play_1:active{ background-position: 0 0;}

    #play_2{background: url("/public/flash/game/3e137d9e63d5a8e34fefb8bfd1aab357/lianximoshi.png") 0 -160px;
        width: 202px;height: 80px;display: block;text-indent: -9999px;position: relative;top:380px;left: 342px;}
    #play_2:hover{ background-position: 0 -80px;}
    #play_2:active{ background-position: 0 0;}
    -->
</style>
<div id="game_main">
    <a href="javascript:void(0)" id="play_1">现金模式</a>
    <a href="javascript:void(0)" id="play_2">练习模式</a>
</div>
<script>
    var pre_url = "/flash/game/3e137d9e63d5a8e34fefb8bfd1aab357/GameGS.php";
    var params = "?uid="+uid+"&username="+username+"&timestamp="+timestamp+"&access_token="+access_token;

    function insertFlash(uid,username,timestamp,access_token,gameType,flashUrl,gameId){
        var flashParams = '';
        var Params = {
            allowScriptAccess:'sameDomain',
            allowFullScreen:true,
            quality:'high',
            movie:'Main.swf',
            wmode:'opaque',
            bgcolor:'#312414'
        };
        var  flash_vars = {
            user_id:uid,
            username:username,
            timestamp:timestamp,
            access_token:access_token,
            game_type:gameType
        };
        swfobject.embedSWF(flashUrl, gameId, "100%", "100%", "9.0.0",'expressInstall.swf',flash_vars,Params);
    }

    if(username && uid && timestamp && access_token) {
//        $("#play_1").attr('href',pre_url+params+"&game_type=1").attr('target','_blank');
//        $("#play_2").attr('href',pre_url+params+"&game_type=0").attr('target','_blank');
        var requestParams = {},frameObj,frameHTML;
        requestParams.frame_src = pre_url + params;
        requestParams.width = 1148;
        requestParams.height = 669;
        requestParams.lockresize = false;
        requestParams.maximizable = false;
        requestParams.soundcontrol = false;
        requestParams.handerclose = true;

        /*$("#play_1").click(function(){
            startOneGame(gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].name,'1room'+uid,requestParams,'3e137d9e63d5a8e34fefb8bfd1aab357');
            frameObj = "win_3e137d9e63d5a8e34fefb8bfd1aab357_1room"+uid;
            var game_url = pre_url + params + "&game_type=1&v="+ window.parent.gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].version+'&source=' + window.parent.app_id + '&currency_allowed=cash';
            var gameId = frameObj+'_game';
            if(document.getElementById(gameId) !== null) return false;
            frameHTML = "<iframe id='"+ gameId +"' src='" + game_url + "' width='" + requestParams.width + "'  height='"+ requestParams.height +"'>";
            $("#"+frameObj).html(frameHTML+$("#"+frameObj).html());setTimeout(function(){$("#"+frameObj).html(frameHTML+$("#"+frameObj).html())},2000);

        });


        $("#play_2").click(function(){
            startOneGame(gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].name,'0room'+uid,requestParams,'3e137d9e63d5a8e34fefb8bfd1aab357');
            //判断窗口是否已经打开，如果是，则直接返回，不再弹窗
            frameObj = "win_3e137d9e63d5a8e34fefb8bfd1aab357_0room"+uid;
            var game_url = pre_url + params + "&game_type=0&v="+ window.parent.gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].version+'&source=' + window.parent.app_id + '&currency_allowed=cash';
            var gameId = frameObj+'_game';
            if(document.getElementById(gameId) !== null) return false;
            frameHTML = "<iframe id='"+ gameId +"' src='" + game_url + "' width='" + requestParams.width + "'  height='"+ requestParams.height +"'>";
            $("#"+frameObj).html(frameHTML+$("#"+frameObj).html());
			setTimeout(function(){$("#"+frameObj).html(frameHTML+$("#"+frameObj).html())},2000);
        });*/
		 $("#play_1").click(function(){
            startOneGame(gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].name,'1room'+uid,requestParams,'3e137d9e63d5a8e34fefb8bfd1aab357');
            frameObj = "win_3e137d9e63d5a8e34fefb8bfd1aab357_1room"+uid;

            $.get('/game/info/3e137d9e63d5a8e34fefb8bfd1aab357',function (data) {
                var game_url = pre_url + params + "&game_type=1&v="+gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].version+'&source=' + window.parent.app_id + '&currency_allowed=cash';
                game_url+="&extra="+JSON.stringify(data.extra);
                var gameId = frameObj+'_game';
                if(document.getElementById(gameId) !== null) return false;
                frameHTML = "<iframe frameborder='0' id='"+ gameId +"' src='" + game_url + "' width='" + requestParams.width + "'  height='"+ requestParams.height +"'>";
                setTimeout(function(){$("#"+frameObj).html(frameHTML+$("#"+frameObj).html())},2000);
            })

        });


        $("#play_2").click(function(){
            startOneGame(gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].name,'0room'+uid,requestParams,'3e137d9e63d5a8e34fefb8bfd1aab357');
            //判断窗口是否已经打开，如果是，则直接返回，不再弹窗
            frameObj = "win_3e137d9e63d5a8e34fefb8bfd1aab357_0room"+uid;
            $.get('/game/info/3e137d9e63d5a8e34fefb8bfd1aab357',function (data) {
                var game_url = pre_url + params + "&game_type=0&v=" + gameList['3e137d9e63d5a8e34fefb8bfd1aab357'].version + '&source=' + window.parent.app_id + '&currency_allowed=cash';
                game_url+="&extra="+JSON.stringify(data.extra);
                var gameId = frameObj + '_game';
                if (document.getElementById(gameId) !== null) return false;
                frameHTML = "<iframe frameborder='0' id='" + gameId + "' src='" + game_url + "' width='" + requestParams.width + "'  height='" + requestParams.height + "'>";
                setTimeout(function () {
                    $("#" + frameObj).html(frameHTML + $("#" + frameObj).html())
                }, 2000);
//            $("#"+frameObj).html(frameHTML+$("#"+frameObj).html());
            }
        });
    }
</script>